import {BaseModel} from "../BaseModel";

export class Publisher extends BaseModel{

    constructor(){
        super();
        this.symbolName = "Publisher";
        this.tableName = "t_publisher";
        this.id = '';//主键id
        this.name = '';//名称
        this.eduLevelId = '';//学段id
        this.brief = '';//简介
        this.version = -1;//课程的版本号，用于判断更新
        this.reverse1 = '';//备用字段1
        this.reverse2 = '';//备用字段2
        this.reverse3 = '';//备用字段3
    }

    dbMapper(){
        return {
            id: 'id',
            name: 'name',
            eduLevelId: 'edu_level_id',
            brief: 'brief',
            version: 'version',
            reverse1: 'reverse1',
            reverse2: 'reverse2',
            reverse3: 'reverse3'
        }
    }

    /**
     * 输出转换
     * @param obj
     * @returns {Book}
     */
    mappingModel(obj){
        let publisher = new Publisher();
        publisher.id = obj.id ? obj.id : ''
        publisher.name = obj.name ? obj.name : ''
        publisher.eduLevelId = obj.edu_level_id ? obj.edu_level_id : ''
        publisher.brief = obj.brief ? obj.brief : ''
        publisher.version = obj.version ? obj.version : -1
        publisher.reverse1 = obj.reverse1 ? obj.reverse1 : ''
        publisher.reverse2 = obj.reverse2 ? obj.reverse2 : ''
        publisher.reverse3 = obj.reverse3 ? obj.reverse3 : ''
        return publisher;
    }

}
